Hansen and Singleton (1982) considers the maximization of expected utility,
\begin{align*} \max \mathbb{E} \sum_{t=0}^\infty \beta^t U(C_t) \end{align*} with respect to the budget constraint, \begin{align*} C_t + \sum_{j=1}^J P_{jt} Q_{jt} = \sum_{j=1}^J P_{jt} Q_{j, t-1} + W_t,\ t= 0, 1, \cdots, \end{align*} where $C_t$ is the consumption at time $t$, $P_{jt}$ is the price of security $j$ at time $t$, $Q_{jy}$ is the amount of security $j$ at time $t$, $J$ is the number of securities and $W_t$ is the labor income at time $t$.
Then, they show that the first order condition is \begin{align*} P_{jt} = \mathbb{E} \bigg[ \beta \frac{U'(C_{t+1})}{U'(C_t)} P_{j, t+1} \bigg],\ j = 1, \cdots, J. \end{align*}
I tried to see it in the simplest case, where $t=1$ and maximize $U(C_0) + \beta U(C_1)$ with the Lagrange multiplier, but I could not get the similar first order condition. This seems to be a canonical example of non-linear GMM.