Let $R$ be a nontrivial ring and $P$ be a proper ideal of $R$ such that for any $a, b\in R$ we have $ab \in P$ implies either $a\in P$ or $b\in P$ then $P$ is a prime ideal of $R$.
The proof is very easy. But the converse of the above statement is not true in general (it is true if $R$ is commutative). I have not found any counterexample for the converse part. I thought on the ring of real matrices but ultimately failed. Can anyone give me an example of a prime ideal of a ring which doesn't satisfy the condition?
An ideal $P$ in the ring $R$ is called completely prime (see Wikipedia if it satisfies the pointwise condition
$$\forall x,y \in R: xy \in P \implies (x \in P \lor y \in P)$$
and the usual definition for a prime ideal (as you also wrote in the comments) is then whenever $A,B$ are ideals of $R$ (left or right of the same type, or both two-sided) and $AB \subseteq P$ then $A \subseteq P$ or $B \subseteq B$. The Wikipedia page states that a completely prime ideal is prime and gives a counterexample: the ring $R$ of $n \times n$-matrices ($n=2$ say, for definiteness ) over a field (say the rationals) and $P$ the zero-ideal in $R$. E.g. $\begin{bmatrix} 0 & 1\\ 0 &0\end{bmatrix}$ is not in $P$, but its square is.