UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ERM/qe44yhin30kSjCgAE2uiqK1H/3L9FnkTpBEnYbU='
WHERE
key_id = '7ce37b3e35ac0375d5e8a1fe400bc86ee4245d127e39e0676e601081f35ce31b'
AND (
token = 'ERM/qe44yhin30kSjCgAE2uiqK1H/3L9FnkTpBEnYbU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)