UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '532iODR87OFB6EhCOOGX1h0ueOVVttAisgcreOEx9gg='
WHERE
key_id = 'ec9cf9cff4eb15c71f5bdae0c28f869bd03b83acb4a46b181f8c486f3ad439d7'
AND (
token = '532iODR87OFB6EhCOOGX1h0ueOVVttAisgcreOEx9gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)