UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '99rEw8Fh2HAOxlNuVSOiWYRXf8NF4jwLn7r4CAiHuws='
WHERE
key_id = 'bccca23b7663ac0c327e143b0fe4fc0954934b980e52e92aa4144e0d4c275cdf'
AND (
token = '99rEw8Fh2HAOxlNuVSOiWYRXf8NF4jwLn7r4CAiHuws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)