Mustard seeds clump in humid spice racks because they are hygroscopic, meaning they readily absorb moisture from the air, causing them to stick together. This moisture absorption leads to the formation of clumps.
Mustard seeds, like many other spices, contain natural oils and starches. When exposed to humidity, the moisture in the air is drawn to these components. The moisture dissolves some of the surface starches and oils, creating a sticky film. As the seeds come into contact with each other, this sticky film acts like a glue, binding them together and forming clumps. The higher the humidity, the faster and more pronounced this clumping effect becomes. Furthermore, temperature fluctuations can exacerbate the problem. Warm temperatures increase the air's capacity to hold moisture, and when the temperature drops, this moisture can condense on the cooler surfaces of the spice rack and the seeds themselves, accelerating the clumping process.
Store your mustard seeds (and all spices) in airtight containers in a cool, dark, and dry place. Consider adding a desiccant packet (like silica gel) to the container to absorb any excess moisture and prevent clumping.