UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XIXYOFLsP3BK4zWGtL4pH1jYR5YjROEzNGc/j5P3T84='
WHERE
key_id = '37f342c69f77a2268209ff100fe9ac9f53a89184a3b59e080760cb1e5a66cd83'
AND (
token = 'XIXYOFLsP3BK4zWGtL4pH1jYR5YjROEzNGc/j5P3T84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)