Mass calibration of the CODEX cluster sample using SPIDERS spectroscopy – II. The X-ray luminosity–mass relation