UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3JoHgWUPw5RoiGCPlcd9fddCT5yMr9d3ifxJdhwvacs='
WHERE
key_id = 'd9e33fddff18fff83833af847cdb561371b88c3e0840e7dcc02fdd39fb119b04'
AND (
token = '3JoHgWUPw5RoiGCPlcd9fddCT5yMr9d3ifxJdhwvacs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)