Let $A \subseteq A[w] \subseteq C$ be three Noetherian integral domains, over a field $k$ of characteristic zero, with $A \subseteq C$ an algebraic ring extension (in particular, $w$ algebraic over $A$).
Further assume that: (1) $A$ and $C$ are unique factorization domains (UFD's).
(2) $A \subseteq C$ is root closed, namely, for all $n$, if $c \in C$ satisfies $c^n \in A$, then $c \in A$.
(3) $w$ is an irreducible element of $C$ (hence it is also an irreducible element of $A[w]$). Notice that, since $C$ is assumed to be a UFD, the assumption that $w$ is irreducible in $C$ implies that it is prime in $C$ (but it can be non-prime in $A[w]$).
(4) $w$ is a prime element of $A[w]$.
Is it true that $A[w]$ must be a UFD? Or, is there a counter-example?
Remark: Without assuming (2),(3),(4) it is easy to find a counter-example: $k[t^2] \subset k[t^2][t^3] \subset k[t]$ ($w=t^3$). Clearly, $k[t^2]$ and $k[t]$ are UFD's, but $k[t^2][t^3]$ is not a UFD, since $t^3$ is an irreducible element of $k[t^2][t^3]$ which is not prime: $t^3t^3=t^2t^2t^2$.
Somewhat relevant questions are: 1, 2.
Edit: After receiving a nice counter-example to my original question, it would be nice to know which additional conditions are required in order to guarantee that $A[w]$ is a UFD; for example, finding:
(i) Finding a special form of the minimal polynomial of $w$ over $A$ or additional.
(ii) Additional properties of the ring extension $A \subseteq C$, such as flatness/separability (I am not sure I know whether the counter-example is flat/separable or not).
(iii) The only invertible elements of $C$ are $k^*$ (this is clearly not satisfied by the counter-example).