UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F7g2AdRr4Sv4slB1J/fRIOL+E3VXtAILuCjX16CMsp4=' 
WHERE 
  key_id = '3aeb59914e449ffcdec6a590540f2afd10d685171e7627087589074e8ee880a7' 
  AND (
    token = 'F7g2AdRr4Sv4slB1J/fRIOL+E3VXtAILuCjX16CMsp4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038