Hamiltonians separable in cartesian coordinates and third-order integrals of motion