Multihunter's answer is great, and can be modified slightly to mitigate the problem that they point out of the large cumulative squared terms.
Each accumulator variable can be divided by $n$...
$$ \hat{x} = \frac{\sum_{i=1}^{n}x_i}{n}=\bar{x} \qquad \hat{y} = \frac{\sum_{i=1}^{n}y_i}{n}=\bar{y} $$ $$ \hat{a} = \frac{\sum_{i=1}^{n}x_i^2}{n} \qquad \hat{b} = \frac{\sum_{i=1}^{n}y_i^2}{n} \qquad \hat{c} = \frac{\sum_{i=1}^{n}x_iy_i}{n} $$
...which slightly modifies the on-demand correlation function to...
$$ r=\frac{\hat{c}-\hat{x}\hat{y}}{\sqrt{\hat{a}-\hat{x}^2}\sqrt{\hat{b}-\hat{y}^2}} $$
For an additional $k$ new data samples (resulting in a new total of $n+k$ samples), the accumulator variables can be updated as follows...
$$ \hat{x}_{n+k} = \hat{x}_n+\frac{\sum_{i=n+1}^{n+k}{x_i}-k\hat{x}_n}{n+k} \qquad \hat{y}_{n+k} = \hat{y}_n+\frac{\sum_{i=n+1}^{n+k}{y_i}-k\hat{x}_n}{n+k} $$ $$ \hat{a}_{n+k} = \hat{a}_n+\frac{\sum_{i=n+1}^{n+k}{x_i^2}-k\hat{a}_n}{n+k} \qquad \hat{b}_{n+k} = \hat{b}_n+\frac{\sum_{i=n+1}^{n+k}{y_i^2}-k\hat{b}_n}{n+k} \qquad \hat{c}_{n+k} = \hat{c}_n+\frac{\sum_{i=n+1}^{n+k}{x_iy_i}-k\hat{c}_n}{n+k} $$
Those update functions can be simplified somewhat by multiplying throughthe leading term by $\cfrac{n}{n}$$\frac{n+k}{n+k}$ and combining everything into a single fraction, but that reintroduces the issue of potentially having to deal with very large intermediate terms.