Taking the answer in advance, the second formula is the general one. Thus the first is not always valid.
But let's derive shortly the angular momentum principle (AMP) for a point mass. To do so, let's look at this general situation:

The definition of angular momentum $\underline H_B$ w.r.t. a generic point B is:
$$\underline H_B(t):=\underline\varrho_B(t) \times \underline P(t)$$
and the definition of the resultant torque around w.r.t a point $B$ is:
$$\underline M_B:=\underline \varrho_B\times\underline F$$
where F denotes the summ of all forces on the point mass.
to get the AMP, we need to differentiate $\underline H_B$ with respect to time. Using the product rule we get:
$$\underline{\dot H} = \frac{\mathrm d}{\mathrm d t}\left(\underline\varrho_B \times \underline P\right) = \underline{\dot\varrho_B} \times \underline P + \underline\varrho_B \times \underline{\dot P} = \underline{\dot\varrho_B} \times \underline P + \underline\varrho_B \times \underline F$$
now, let's use $\underline \varrho = \underline r - \underline r_B$ and thus $ \underline {\dot\varrho} = \underline {\dot r} - \underline {\dot r_B} = \underline v - \underline v_B$ to get:
$$\underline{\dot H} = (\underline v - \underline v_B)\times \underline P + \underline M_B$$
but since the cross product of two parallel vectors vanishes, $\underline v \times \underline P = \underline v \times (m\underline v) = \underline 0$, we can simplify it to the following:
$$\underline {\dot H_B} + \underline v_B \times \underline P = \underline M_B$$
For the other formula mentioned to be valide, it must hold $\underline v_B \times \underline P = 0$. We only get this if either $\underline v_B = 0$ (B is fixed) or $\underline v_B || \underline P$.