UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Fh13l6sS3Hvn7Owm8sdD7bNXTDBC5EpJUT2NFAmTr3A='
WHERE
key_id = '39376b661f77c5acb7c11dfa71d175bd1ecc27815c44c7444724f95e8a05295d'
AND (
token = 'Fh13l6sS3Hvn7Owm8sdD7bNXTDBC5EpJUT2NFAmTr3A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)