Mean field approach to the electron glass