Several dynamical properties of electromagnetic waves such as energy, momentum, angular momentum, and optical helicity have been recently reexamined in dispersive and lossless media. Here, we address an alternative derivation for the optical chirality, extending it so as to include dissipative effects as well. To this end, we first elaborate on the most complete form of the conservation law for the optical chirality, without any restrictions on the nature of the medium. As a result we find a general expression for the optical chirality density both in lossless and lossy dispersive media. Our definition is perfectly consistent with that originally introduced for electromagnetic fields in free space, and is applicable to any material system, including dielectrics, plasmonic nanostructures, and left-handed metamaterials.