Let $\tau=\inf\{t\geqslant0\mid x_t=0\}$. Since $x_t=w_t-Mt+d$, $\tau=\inf\{t\geqslant0\mid w_t=Mt-d\}$. Thus $\tau$ is a stopping time for $(w_t)$. Assume that $\tau$ is integrable. Then the optional stopping theorem yields $\mathrm E(w_\tau)=\mathrm E(w_0)=0$, hence $\mathrm E(x_\tau)=d-M\mathrm E(\tau)$. Since $\tau$ is integrable, $\tau$ is almost surely finite, hence $x_\tau=0$ almost surely, and $\mathrm E(\tau)=d/M$.
It remains to show that $\tau$ is integrable. But $[\tau\geqslant t+(d/M)]\subseteq A_t$ with $A_t=[w_t\geqslant Mt]$. By scaling, $\mathrm P(A_t)=\mathrm P(w_1\geqslant M\sqrt{t})$. When $t\to+\infty$, $\mathrm P(w_1\geqslant M\sqrt{t})=O(\mathrm e^{-t/2})$ hence $\tau$ is integrable (in fact, this proves that $\mathrm e^{c\tau}$ is integrable, for every $c\lt1/2$). The proof is complete.
Another method is to compute $t_h(x)=\mathrm E_x(\tau_{h})$ for every $0\leqslant x\leqslant h$, where $ \tau_{h}=\inf\{t\geqslant0\mid x_t\in\{0,h\}\}. $ Then $t_h(0)=t_h(h)=0$ and, as you mentioned, \frac12t''_h(x)-Mt'_h(x)=-1 for every $x$ in $(0,h)$. The two boundary conditions yield $ t_h(x)=\frac{x}M-\frac{h}M\,\frac{\mathrm e^{2Mx}-1}{\mathrm e^{2Mh}-1}. $ Since $\tau=\sup\limits_h\ \tau_h$, $t_h(x)\to \mathrm E_x(\tau)$ when $h\to+\infty$, and $\mathrm E_x(\tau)=x/M$ for every $x\geqslant0$.