Let
- $A$ play $\$40$ with probability $p \in [0,1]$ and $\$60$ with probability $1-p$.
- $B$ play $\$40$ with probability $q \in [0,1]$ and $\$60$ with probability $1-q$.
The expected payoff for $A$ (and also for $B$) is
$$20 pq + 50 p (1-q) + 50 (1-p) q + 30 (1-p) (1-q) = \color{blue}{-50 pq + 20 p + 20 q + 30}$$
Taking the partial derivatives and finding where they vanish, we obtain the critical probabilities
$$p^*, q^* := \frac{2}{5}$$
We have a candidate mixed Nash equilibrium with expected payoff
$$-50 \left(\frac{2}{5}\right)^2 + 20 \left(\frac{2}{5}\right) + 20 \left(\frac{2}{5}\right) + 30 = - 8 + 8 + 8 + 30 = \color{blue}{\$38}$$
Let $q^* = \frac 25$ be fixed and $p$ be free. The expected payoff for $A$ is
$$-50 \left(\frac{2}{5}\right) p + 20 p + 20 \left(\frac{2}{5}\right) + 30 = - 20 p + 20 p + 8 + 30 = \color{blue}{\$38}$$
We conclude that $A$ has no incentive to unilaterally deviate from $p^* = \frac 25$ when $B$ chooses $q^* = \frac 25$, as his expected payoff remains $\$38$. Likewise, $B$ has no incentive to unilaterally deviate from $q^* = \frac 25$ when $A$ chooses $p^* = \frac 25$. Hence, $(p^*, q^*)$ is indeed a mixed Nash equilibrium.
There are also two pure Nash equilibria, each with expected payoff $\color{blue}{\$50}$.