Planck intermediate results: XXIV. Constraints on variations in fundamental constants