That would be the same path that a light ray would take, through media with different refractive indices.

Without loss of generality, we can move the "sand" stripe to start at B.
Then the optical analogy will tell us that the refractive index of "sand" is
$2$ and that
$$
\sin \theta _{\,2} = 2\sin \theta _{\,1}
$$
Without going into precise calculations, we can consider that
$$
3/4 < \tan \theta _{\,2} < 1
$$
so that $\theta _{\,1} $ will be approximately $\pi / 8$ , which means $ \tan \theta _{\,1} \approx \sqrt{2}-1 \approx 0.4$.
Therefore the path will enter the sand strip about $4$ m below $B$.
The time is then approximately
$$
t \approx {{\sqrt {100 + 16} } \over 5} + {{\sqrt {900 + 26^{\,2} } } \over {10}} \approx {{11} \over 5} + {{40} \over {10}} \approx 6.2 \approx \sqrt {38}
$$
and yes, $\sqrt {34}$ looks to be too low.
Note that the path that goes straight up at $45^\circ$and then horizontally across the "sand" would take
$$
t = {{10} \over 5} + {{\sqrt {1800} } \over {10}} = 2 + 3\sqrt 2 = 6.24
$$
while the straight line from $A$ to $B$ would take
$$
t = {{\sqrt {100 + 900/16} } \over 5} + {{30\sqrt {1 + 9/16} } \over {10}} = {{50} \over {20}} + {{150} \over {40}} = {{250} \over {40}} = 6.25
$$
-- notes --
The optical analogy helps in saying that, the piecewise path from A to B which attains the minimum time to be traversed
shall obey to the Refraction Law
$$
{{\sin \theta _{\,1} } \over {\sin \theta _{\,2} }} = {{v_{\,1} } \over {v_{\,2} }} = {{n_{\,2} } \over {n_{\,1} }}
$$
which is valid also for mechanical particles (and for humans).

Since the above law is bidirectional, then we will have the situation depicted in this sketch, to confirm that the horizontal placement of the
sand strip is ininfluential on the total time.
The exact solution will translate into finding the solution to
$$
\eqalign{
& 10\tan \theta _{\,1} + 30\tan \theta _{\,2} = 30\quad \Rightarrow \cr
& \Rightarrow \quad 10{{\sin \theta _{\,1} } \over {\sqrt {1 - \sin ^{\,2} \theta _{\,1} } }} + 30{{2\sin \theta _{\,1} } \over {\sqrt {1 - 4\sin ^{\,2} \theta _{\,1} } }} - 30 = 0 \cr}
$$
which leads to a 4-th degree equation, as already evidenced in a previous answer.