Are you working through Abraham's chapter in the handbook? I think he omits the proof of this fact because it's elementary and a little gritty, though it's an essential part of his proof that a two-step iteration of proper forcings is proper.

We'll need the fact that generics for $\ast$-products can be factored: $K$ is generic for $P \ast \dot{Q}$ if and only if there are generics $G$ for $P$ and $H$ for $\dot{Q}_G$ such that $K = G \ast H = \{(p, \dot{q}): p \in G, \dot{q}_G \in H\}$. (Throughout, I'll abbreviate $\dot{Q}_G$ as $Q$, $\dot{q}_G$ as $q$, etc.)

I'll use the following definition for master conditions: $p$ is $(M, P)$-generic iff for every dense set $D \in M$, we have $p \Vdash \dot{G} \cap D \cap M \neq \emptyset$ (i.e., for every generic $G \ni p$ and dense set $D \in M$, we have $G \cap D \cap M \neq \emptyset$).

Now, assume first that $(p_0, \dot{q_0})$ is $(M, P \ast \dot{Q})$-generic. Fix $G$ a generic for $P$, and $D \subseteq P$ a dense set with $D \in M$. To establish the $(M, P)$-genericity of $p_0$, we need to show $G \cap D \cap M \neq \emptyset$. Let $D' = \{(p, \dot{q}): p \in D\}$. Then $D'$ is dense in $P \ast \dot{Q}$, and further $D' \in M$ since it is defined in terms of $D$. Let $H$ be an arbitrary generic for $Q$ containing $q_0$. Then since $G \ast H$ contains the master condition $(p_0, \dot{q_0})$, we have $G \ast H \cap D' \cap M \neq \emptyset$, which gives $G \cap D \cap M \neq \emptyset$, as desired.

To show that $p_0 \Vdash \dot{q_0}$ is $(M[\dot{G}], \dot{Q})$-generic, we must prove that if we are given generics $G \ni p_0$ for $P$ and $H \ni q_0$ for $Q$, and $E \in M[G]$ that is dense in $Q$, we have $E \cap H \cap M[G] \neq \emptyset$. Fix such $G, H, E$. Let $\dot{E}$ be a name for $E$ with $\dot{E} \in M$, and find $p_1 \in G$ such that $p_1 \Vdash \dot{E}$ is dense in $\dot{Q}$. Let $E' = \{(p, \dot{q}): p \Vdash \dot{q} \in \dot{E}\}$. Then $E' \in M$. One checks that $E'$ is dense in $P \ast \dot{Q}$ below $(p_1, \dot{1_Q}) \in G \ast H$. Then since $G \ast H$ contains the master condition $(p_0, \dot{q_0})$, we have $G \ast H \cap E' \cap M \neq \emptyset$. Unraveling the definitions gives $H \cap E \cap M[G] \neq \emptyset$, as desired.

For the converse, suppose $p_0$ is $(M, P)$-generic and $p_0 \Vdash \dot{q_0}$ is $(M[G], \dot{Q})$-generic. Let $K$ be generic for $P \ast \dot{Q}$, with $(p_0, \dot{q_0}) \in K$. Factor $K$ as $G \ast H$. Then we have $p_0 \in G$ and $q_0 \in H$. Let $D \in M$ be dense in $P \ast \dot{Q}$. To show $(p_0, \dot{q_0})$ is $(M, P \ast \dot{Q})$-generic, we must witness $G \ast H \cap D \cap M \neq \emptyset$.

Now, one may view $D$ as a $P$-name for a subset of $Q$. It's evaluation $D_G$ is just $\{q: \exists (p, \dot{q}) \in D$ s.t. $p \in G$ and $\dot{q}_G = q\}$. One may check that since $D$ is dense in $P \ast \dot{Q}$, we have that $D_G$ is dense in $Q$. Of course, since $D \in M$, we have $D_G \in M[G]$.

We'll need the following two facts.

$\textbf{Fact 1}$: For any set $A \in M$, we have $A \cap M = A \cap M[G]$.

We need only prove the containment $\supseteq$. If $x \in A \cap M[G]$ then there is a name $\dot{x} \in M$ for $x$ and a $p \in G$ such that $p \Vdash \dot{x} \in \check{A}$. The set $E = \{q: \exists y \in A$ such that $q \Vdash \dot{x} = \check{y}\}$ is defined with parameters from $M$, hence in $M$, and dense in $P$ below $p$. Since $G$ contains the master condition $p_0$, we may find a $q \in G \cap E \cap M$. Of course, $q$ must decide the value of $\dot{x}$ is $x$. Hence we must have $x \in M$, as desired.

$\textbf{Fact 2}$: For any $P$-name $\sigma \in M$, we have $(\sigma \cap M)_G = \sigma_G \cap M[G]$.

Again the containment $\subseteq$ is easy, so assume $x \in \sigma_G \cap M[G]$. Since $x \in \sigma_G$, we must have

$\exists (p, \dot{x}) \in \sigma \, \textrm{with} \, p \in G \, \textrm{and} \, \dot{x}_G = x$.

This statement only involves parameters in $M[G]$, and it is true in $H_{\lambda}[G]$. It is a general fact that $M[G] \prec H_{\lambda}[G]$, and so by elementarity we may find such a $(p, \dot{x})$ in $\sigma \cap M[G]$. By fact 1, this gives $(p, \dot{x}) \in \sigma \cap M$. Hence $x \in (\sigma \cap M)_G$, as desired.

Now we can finish the argument. Since $p_0 \in G$, we have by hypothesis that $q_0$ is $(M[G], Q)$-generic. Hence $D_G \cap M[G] \cap H \neq \emptyset$. By the second fact this gives $(D \cap M)_G \cap H \neq 0$. Say $q \in (D \cap M)_G \cap H$. Then there is $(p, \dot{q}) \in D \cap M$ with $p \in G$ and $\dot{q}_G = q \in H$. But this means $(p, \dot{q}) \in G \ast H$, hence $G \ast H \cap D \cap M \neq 0$, as desired.