UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/0hJ2YYcOAAJ4YTlkQSWq2LDin7m0Vek1pUYNiD7Mh8='
WHERE
key_id = 'f8d50294d6ac2406ffdcd7b23a08422f2144665f9f5b84992972dd6ef0571c12'
AND (
token = '/0hJ2YYcOAAJ4YTlkQSWq2LDin7m0Vek1pUYNiD7Mh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)