UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OATf+hnWCCQN0NIYbqPKCLF1Gs18ATzbOS0Lr+kQsFg=' 
WHERE 
  key_id = '331e8ea6c6978d64b5fcc76f0174b448ae5fb683235b0aaffd9055d4f1503302' 
  AND (
    token = 'OATf+hnWCCQN0NIYbqPKCLF1Gs18ATzbOS0Lr+kQsFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015