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

Query time 0.00048