  In this paper we revisit the relation between the Friedmann equations and the
first law of thermodynamics. We find that the unified first law firstly
proposed by Hayward to treat the "outer"trapping horizon of dynamical black
hole can be used to the apparent horizon (a kind of "inner" trapping horizon in
the context of the FRW cosmology) of the FRW universe. We discuss three kinds
of gravity theorties: Einstein theory, Lovelock thoery and scalar-tensor
theory. In Einstein theory, the first law of thermodynamics is always satisfied
on the apparent horizon. In Lovelock theory, treating the higher derivative
terms as an effective energy-momentum tensor, we find that this method can give
the same entropy formula for the apparent horizon as that of black hole
horizon. This implies that the Clausius relation holds for the Lovelock theory.
In scalar-tensor gravity, we find, by using the same procedure, the Clausius
relation no longer holds. This indicates that the apparent horizon of FRW
universe in the scalar-tensor gravity corresponds to a system of
non-equilibrium thermodynamics. We show this point by using the method
developed recently by Eling {\it et al.} for dealing with the $f(R)$ gravity.
