Deriving First Order Condition of Hansen and Singleton (1982) 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.
This has nothing to do with GMM, which is a statistical method for estimating parameters. This is a macroeconomics model or say a dynamic optimization problem.
From FOCs for $C_t$, $C_{t+1}$, and $Q_{jt}$, youg can get $$\mathbb{E}\frac{\beta U'(C_{t+1})}{U'(C_t)} = \frac{\lambda_{t+1}}{\lambda_t}$$, and $$\lambda_t P_{jt} = \lambda_{t+1} P_{jt+1}$$.
Then by replacing $\lambda$ you have $$P_{j t} U^{\prime}\left(C_{t}\right)=\beta \mathbb{E} \left[P_{j t+1} U^{\prime}\left(C_{t+1}\right)\right]$$.