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

Query time 0.00030