Let $X$ be a smooth scheme of finite type over an algebraically closed field of characteristic zero and with a trivial class group $Cl(X)=0$. Let $Y$ be a dense open subscheme of $X$ such that:

1) $Y$ is a quasi-affine scheme s.t. $\Gamma(\mathcal{O}_Y,Y)$ is of finite type; and

2) $X \setminus Y$ is irreducible of codimension at least two.

Does these conditions imply that $X$ is itself a quasi-affine scheme? If not, can anyone provide a counter-example please?

Thank you in advance!