UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b4CrmoX2iTaKN8zIp1Usqb3lKoQg1ZQwtKK1VPUYlLI=' 
WHERE 
  key_id = '8e77440a120dbf8a2e664f462b82707b3e883ded936979b2a8484fa983b84325' 
  AND (
    token = 'b4CrmoX2iTaKN8zIp1Usqb3lKoQg1ZQwtKK1VPUYlLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035