Let $f : A \to B$ be a morphism between unital commutative rings. We can thus consider $B$-modules as $A$-modules via this map, and $A$-modules as $B$-modules via tensoring with $- \otimes_A B$.
Not let $M$ and $N$ be $A$- and $B$-modules respectively. Given a prime $q$ of $B$ and lying over a prime $p$ in $A$, we know that $f$ descends to a map between the respective localizations and so a similar correspondence as above holds for their respective modules.
I want to show that $$ M_p \otimes_{A_p} N_q \simeq (M \otimes_A N)_q, $$ as $B_q$-modules.
My reasoning is as follows: since
$$ (M \otimes_A N)_q \simeq M \otimes_A N \otimes_B B_q \simeq M \otimes_A N_q, $$
and $N_q$ is a $B_q$-module, it is an $A_p$-module, hence $N_q \simeq A_p \otimes_{A_p} N_q$ and therefore
$$ (M\otimes _A N)_q \simeq M \otimes_A A_p \otimes_{A_p} N_q \simeq M_p \otimes_{A_p} B_q. $$
This sounds okay but I am using the "associativity of tensor product with respect to different rings" without caring much about it.
A sanity check and/or a reference would be much appreciated.
Your argument works! You've simply applied the fact that if $f : A\to B$ is a ring morphism, $M$ is a right $A$-module, $N$ is a $(A,B)$-bimodule, and $L$ is a left $B$-module, then $(M\otimes_A N)\otimes_B L\cong M\otimes_A (N\otimes_B L)$ (see here). Let us call this fact $(*).$ As you know, if $M$ is an $R$-module and $S\subseteq R$ is a multiplicative set, then $S^{-1}M\cong M\otimes_R S^{-1}R;$ call this fact $(**).$ Then your argument is the following computation: \begin{align*} (M\otimes_A N)_q &\cong (M\otimes_A N)\otimes_B B_q\qquad\quad\textrm{(using (**))}\\ &\cong M\otimes_A(N\otimes_B B_q)\qquad\quad\textrm{(using (*))}\\ &\cong M\otimes_A N_q\qquad\qquad\qquad\textrm{(using (**))}\\ &\cong M\otimes_A (A_p\otimes_{A_p} N_q)\qquad\textrm{because }R\otimes_R M\cong M\\ &\cong (M\otimes_A A_p)\otimes_{A_p} N_q\qquad\textrm{(using (*))}\\ &\cong M_p\otimes_{A_p} N_q\qquad\qquad\quad\textrm{(using (**))}. \end{align*}