Non-equilibrium evolution of quantum fields during inflation and late accelerating expansion