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