The evolution of cosmic-ray-mediated magnetohydrodynamic shocks: A two-fluid approach