UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XSv8vOiylM4LHClAGGmDudessHftUnbOiF23TdnqQQE='
WHERE
key_id = 'd72b6c1184b4b489131f3807f98f228e3df28afa5c6c9d42d7e80202050d51e7'
AND (
token = 'XSv8vOiylM4LHClAGGmDudessHftUnbOiF23TdnqQQE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)