Continuous time optimization with two laws of motion (the Hamiltonian with two laws of motion)
In this case you have two state variables, so as you say, you have to check the FOC ($J$ is the Hamiltonian) for $\frac{\partial J}{\partial K}=-\dot\lambda_1$ and $\frac{\partial J}{\partial H}=-\dot\lambda_2$ (besides the FOC for control variables). In this sense the logic is the same as Lagrangian (in static context), there are as many lagrangians, as there are constraints (dynamics/laws of movement in this context). Hope this helps!