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