UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wdjiAjOYaxMWPUmK2E8B6r2ec2FJI8xbcnIpUAXvU9o='
WHERE
key_id = '3181870c47e0daa539014b83e985df249c8603b36f86da991881c361c08c5d37'
AND (
token = 'wdjiAjOYaxMWPUmK2E8B6r2ec2FJI8xbcnIpUAXvU9o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)