UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YfjinMWgzzJLNA0VMJXIKNKj8UF3C5WbRIeZtunfzQw='
WHERE
key_id = '22346af649798c92c64eaff877d6063c21e2d0ab8bc74c361debc9d5ff70c0e4'
AND (
token = 'YfjinMWgzzJLNA0VMJXIKNKj8UF3C5WbRIeZtunfzQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)