Consider Theorem 2.13 ("The Optional Sampling Theorem") in Chapter 2 of Markov Processes: Characterization and Convergence by Stewart N. Ethier and Thomas G. Kurtz. This theorem is about submartingales and involves multiple stopping times, but translating in the standard manner to martingales and setting their first stopping time $\tau_1$ to zero we get the following:
Thm (Optional Stopping Theorem): Let $M$ be a right-continuous $\{\mathcal F_t\}$-martingale, and let $\tau$ be a $\{\mathcal F_t\}$-stopping time. Then for all $T>0$, $\mathbb E[M_{\tau\wedge T}]=M_0$. Moreover, if $\tau$ is finite a.s., if $\mathbb E[|M_\tau|]<\infty$, and if $\lim\limits_{T\to\infty}\mathbb E[|M_T|\mathbb I_{\tau>T}]=0$, then $\mathbb E[M_\tau]=M_0$.
It follows that the optional stopping theorem holds in continuous time if (i) the stopping time $\tau$ is a.s. bounded, or (ii) the stopping time $\tau$ is a.s. finite, $\mathbb E[|M_\tau|]<\infty$, and $\lim\limits_{T\to\infty}\mathbb E[|M_T|\mathbb I_{\tau>T}]=0$. For the particular example with Brownian motion mentioned in the question, we want version (ii).
I'd be remiss if I didn't mention the comments, where the question has already been answered to the original poster's satisfaction. User saz mentions Theorem I.3.2 in Revuz and Yor (Continuous Martingales and Brownian Motion) and Theorem A.18 in Schilling and Partzsch (Brownian Motion: An Introduction to Stochastic Processes). The former gives the theorem for right-continuous* martingales under either assumption (i) (bounded stopping time) or alternatively the assumption that $M$ is uniformly integrable. The latter (after simplifying the statement in the exact same manner as for Ethier and Kurtz) gives the theorem for continuous martingales under either assumption (i) or (ii).
Ethier and Kurtz has the advantage that it doesn't assume that the martingale is continuous. But Schilling and Partzsch is a newer text with less terse exposition, and might be preferable for that reason (that's my guess from glancing at it, anyway — it's not a text I'm familar with).
I should also mention that (as discussed in the exposition preceding the theorem in Ethier and Kurtz) the assumption of right-continuity is not usually important, since most martingales of interest are already right-continuous and those that aren't have right-continuous modifications under reasonable assumptions.
*It doesn't say "right-continuous" in the theorem, but at the beginning of the section they pull the old "We recall that all the (sub,super)martingales we consider henceforth are cadlag" trick. Confusingly, in their Thm I.3.3 they do explicitly assume the supermartingale under consideration is right-continuous, so a skimming reader could be forgiving for thinking the text does not assume right-continuity. But anyway, as discussed above this isn't really important.