UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fH1oPYd2bT8KeT89t+gJOkiDzdZCMqLSgz0f7xLl9RY='
WHERE
key_id = 'ef023732218f44f2855703b438508e533ce382bc332b2b5187b0430533d364bc'
AND (
token = 'fH1oPYd2bT8KeT89t+gJOkiDzdZCMqLSgz0f7xLl9RY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)