For mean: You would keep two variables: 1. A runnting total 2. A running count of items seen so far. Mean is simply running total divided by running count.
For standard deviation: See John D. Cook's Accurately computing running variance. I have used it in the past in SQL using window function and found it very useful