UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qe8DQHBx23jqUo1b8XzFKuo4Wb+gBAr9uoh4Jls+C5U='
WHERE
key_id = '449a87d71a4a25cf9d109cb5e83e67486d618d62054b844a2089304641bc84a0'
AND (
token = 'Qe8DQHBx23jqUo1b8XzFKuo4Wb+gBAr9uoh4Jls+C5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)