Indeed, the equality will not hold in general. For counterexamples, see this or this.
For sufficient conditions for the equality when $d=1$, see e.g. Folland, Theorem 2.27 or the more general Lemma 2.3. This immediately extends to any $d$ if the derivatives are understood in the Gateaux sense. As seen from the discussion of Theorem 2.27 in Folland, the extension to $d>1$ is somewhat more problematic if the derivatives are understood in the Fréchet sense. This answer may also be of interest to you.