The Curci-Ferrari model with massive quarks at two loops