UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g4Rh5TBAgbXnpU47M7Kv5rZ7MOZkYvr2d9I6pbwA1ck='
WHERE
key_id = '198359963afe7c1d3ec2dad74d0fa1b49501ab34d5c18d14f54ba9780cc8559a'
AND (
token = 'g4Rh5TBAgbXnpU47M7Kv5rZ7MOZkYvr2d9I6pbwA1ck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)