It seems to me that if $X$ is not factorial than one must be careful.
For instance, take the weighted projective space $X=\mathbb{P}(1,1,2)$, and consider the sheaf $\mathcal{O}_X(1)$, whose construction can be found for instance in Dolgachev's paper "Weighted projective varieties". Abstractely, $X$ is isomorphic to a quadric cone in $\mathbb{P}^3$, and the sheaf $\mathcal{O}_X(1)$ has only two sections, so it is not locally free (in fact, it corresponds to a single line in the cone). However, $\mathcal{O}_X(2)$ is locally free, since it corresponds to a hyperplane section (in fact, $X$ is 2-factorial); let $\mathcal{O}_X(-2):=\mathcal{O}_X(2)^*$.
Finally, take
$M:=\mathcal{O}_X(-2) \otimes \mathcal{O}_X(1), \quad N:=\mathcal{O}(1)$.
Then $M \otimes N \cong \mathcal{O}_X$, but $M$ and $N$ are not locally free.
ADDED: As pointed out by D. Arapura in the comment below, there is actually a mistake in this example, since it is $not$ true that $\mathcal{O}_X(1) \otimes \mathcal{O}_X(1) \cong \mathcal{O}_X(2)$; in fact, these sheaves only agree on a dense open set. What is true is that
$\mathcal{O}_X(2a) \otimes \mathcal{O}_X(b) \to \mathcal{O}_X(2a+b)$
is an isomorphism for all integers $a$, $b$, but of course this cannot give any counterexample!
However, it is $always$ true that
$\mathcal{O}_X(a) \to Hom (\mathcal{O}_X(b), \mathcal{O}_X(a+b))$,
is an isomorphism, see the paper of DELORME "Espaces projectifs anisotropes", p. 210.
In particular,
$\mathcal{O}_X(1) \to Hom (\mathcal{O}_X(-1), \mathcal{O}_X)$,
is an isomorphism, even if $\mathcal{O}_X(1) \otimes \mathcal{O}_X(-1) \neq \mathcal{O}_X$.