When finding the equations of motion, one should use the above Hamiltonian, and as long as one is careful to never use constraints before taking derivatives in the Poisson bracket then one gets the correct equations of motion. That is, the equations of motion are given by