UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IAE1ZyVdTB73meN3QrkyxeH7fxIwSfppMH53uYzCnh8='
WHERE
key_id = 'df02854836c6d379bcc2df16e7c3e70dc612812f8f2b224510d0cc3e349d1520'
AND (
token = 'IAE1ZyVdTB73meN3QrkyxeH7fxIwSfppMH53uYzCnh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)