UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4N7Ss0xVQnGaA50yk1hylAHEnCg06fcmpYjcdJls3v4='
WHERE
key_id = '81769adddc5977f47197115d733e7e2dbb676279a4e8b7f4c781767af99c9c1b'
AND (
token = '4N7Ss0xVQnGaA50yk1hylAHEnCg06fcmpYjcdJls3v4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)