Speed of light in a medium is based on its optical density and not its mass density.
When light travels from an optically rarer medium to an optically denser medium, it bends towards the normal, and so, to maintain the time of travel, the speed of light is reduced.
The mass density does not affect this phenomenon.
Hope this helps!