Perhaps something like the following works (I have not checked all the details):

Let $C$ be a smooth plane conic and let $Y$ be the projective cone over $C$. Then $Cl(Y) = \mathbb{Z}$ but the class group of the local ring of the vertex of $Y$ is $\mathbb{Z}/2$. Let $X$ be affine cone over $Y$. Then the class group of the local ring
$R$ of the vertex of $X$ is $\mathbb{Z}$ but it seems that the class group of $R$ localised at the prime ideal corresponding to the cone over the vertex of $Y$ is $\mathbb{Z}/2$.

EDIT

The above is wrong as pointed out by Hailong Dao in his comment. I try to fix it below:

Let Y be as above i.e. the singular quadric in $\mathbb{P}^3$ given by the equation $x^2 + y^2 +z^2 = 0$. It may be viewed as the toric surface given by the complete fan with rays passing through $(1,0)$, $(0,1)$ and $(-1,-2)$. Then $Cl(Y) = \mathbb{Z}$ and $Pic(Y)$ is of index $2$ in $Cl(Y)$. Let $Y'$ be the blowup of $Y$ at a non-singular torus fixed point. We may view
Y as the surface obtained from the fan for $Y$ by adding the ray through the point $(1,1)$. Let $\pi:Y' \to Y$ be the blowup map and let $E$ be the exceptional divisor.
Then $Cl(Y') \cong \mathbb{Z} \oplus \mathbb{Z}$ and $Cl(Y')/\mathbb{Z}E = Cl(Y)$.

Let $H$ be an ample divisor on $Y$. Then for $n >> 0$, $H':= n\pi^*(H) - E$ is an ample divisor on $Y'$ (this is true for the blowup of a point on any surface). Note that $Cl(Y')/\mathbb{Z}H' \cong \mathbb{Z}$, so it is torsion free. SInce $Y'$ is a projective toric surface and $H'$ is an ample divisor, it follows that $H'$ is very ample and gives a projectively normal embedding of $Y'$ in $\mathbb{P}(H^0(Y',\mathcal{O}(H')))$.

As before, we now let $X$ be the cone over $Y'$ and let $R$ be the local ring of the vertex. We let $P$ be the prime ideal corresponding to the cone over the singular point of $Y'$.

($Cl(Y)$ and $Cl(Y')$ can be computed by hand or using the toric description I gave and the results in Fulton, Toric Varieties, Sections 3.3, 3.4; the fact that an ample divisor on a projective toric surface is very ample is an Exercise at the bottom of p.70.)

Note that by letting $R$ be the coordinate ring of $Y' \backslash D$ , where $D$ is a general divisor linearly equivalent to $H'$ (so not containing the singular point) one gets a normal 2-dimensional (non-local) ring with $Cl(R)= \mathbb{Z}$ and with a prime ideal $P$ such that $Cl(R_P)=\mathbb{Z}/2$ . In all of the above one can replace $2$ by any integer $n>1$ (by considering the projective cone over the rational normal curve on degree $n$, or, in the toric description, replacing $(-2,-1)$ by $(-n,-1)$.