UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qVbv8M74U9ce8nKZZHkHvL2/+SOjCH76TWMqXge+HP8='
WHERE
key_id = 'a99856390c5bb28910403ebe90e878147591232851dec69a9e4c7524735df61e'
AND (
token = 'qVbv8M74U9ce8nKZZHkHvL2/+SOjCH76TWMqXge+HP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)