UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AAh2YjDlXMB1x//tqsXka/8lSEQgTpfIquRIHuYzY1c='
WHERE
key_id = 'ffc1e55039d7a780db4fba993d77a7e938012038b8203faffdfbde1dc564e5ad'
AND (
token = 'AAh2YjDlXMB1x//tqsXka/8lSEQgTpfIquRIHuYzY1c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)