UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3XFkHMTH6zIvFoaxmIFSeUzehEaA3CVBzbgaSJep8HE='
WHERE
key_id = 'af3299c128ee258e8b9c218eec59e1ca45715320b29187aac3326ffadecde896'
AND (
token = '3XFkHMTH6zIvFoaxmIFSeUzehEaA3CVBzbgaSJep8HE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)