The question is phrased as whether
$$
\sum_{x\in\mathcal X, y\in\mathcal Y}p(x,y)\log\,p(x) = \sum_{x \in \mathcal X} p(x)\log\,p(x) \quad \text{?}
$$
I disapprove of using the same symbol, $p$, for two different functions. If one instead writes $p_X(x)$ with capital $X$ and lower-case $x$ in the appropriate places, one can then understand such things as the difference between $p_X(4)$ and $p_Y(4)$, and the meaning of $p_X(4)$, and things like $\Pr(X\le x)$.
We have
\begin{align}
& \sum_{\begin{smallmatrix} x\in\mathcal X \\ y\in\mathcal Y \end{smallmatrix}} \Pr(X=x\ \&\ Y=y) \log p(x) & & \text{where $p(x)$ is some function of $x$} \\[10pt]
= {} & \sum_{x\in\mathcal X} \left( \sum_{y\in\mathcal Y} \Pr(X=x\ \&\ Y=y) \log p(x) \right) & & \text{where $p(x)$ is some function of $x$.}
\end{align}
The factor $\log p(x)$ within the sum $\displaystyle\sum_{y\in\mathcal Y}$ does not depend on $y$, i.e. it does not change as $y$ runs through the list of all members of $\mathcal Y$. Therefore we can pull it out, getting this:
$$
\sum_{x\in\mathcal X} \left( (\log p(x)) \sum_{y\in\mathcal Y} \Pr(X=x\ \&\ Y=y) \right)
$$
Now all we need to do is show that
$$
\sum_{y\in\mathcal Y} \Pr(X=x\ \&\ Y=y) = \Pr(X=x).
$$
For example, if $\mathcal Y=\{y_1,y_2,y_3\}$, we would need to show that
$$
\Pr(X=x\ \&\ Y=y_1) + \Pr(X=x\ \&\ Y=y_2) + \Pr(X=x\ \&\ Y=y_3) = \Pr(X=x).
$$
Can you do that?
By definition $\mathsf P(x,y\mid z)~=~\mathsf P(x\mid y,z)~\mathsf P(y\mid z)$ always holds for any random variables $x,y,z$ where $\mathsf P(y\mid z)\neq 0$.
Does any condition should be satisfied if they both equal to P(x,y|z).
Yes. $\mathsf P(x\mid y,z)=\mathsf P(x\mid y)$ exactly when $x\perp z\mid y$ (that is, $x$ and $z$ are conditionally independent when given $y$).
Only when one this is so can we make the substitution to claim $\mathsf P(x,y\mid z)~=~\mathsf P(x\mid y)~\mathsf P(y\mid z)$.
Best Answer
It doesn't seem to be explicitly written out, but it appears as if they assume $S$ and $c$ to be independent conditional on $T$ such that $p(S|T, c)=p(S|T)$. $$ p(T|S, c)=\frac{p(T, S, c)}{p(S, c)}=\frac{p(S|T, c)p(T, c)}{p(S, c)}=\frac{p(S|T, c)p(T| c)p(c)}{p(S, c)}\propto p(S|T, c)p(T| c)=p(S|T)p(T| c) $$ If they are not, then the last equality does not hold.