Quantum detailed balance and KMS condition