UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R9IK0K7jcdBC1vFnNJTceGHh7XHAxn4WFcwV/qgWY9Y='
WHERE
key_id = '7b5aff021b5e209bd2f5bd5d1ce697629e05a73b68410108dd42dd0105dc46a4'
AND (
token = 'R9IK0K7jcdBC1vFnNJTceGHh7XHAxn4WFcwV/qgWY9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)