Masked Contrastive Learning for Anomaly Detection