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