An identity related to centralizers in semiprime rings