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