Revealing impacts of stellar mass and environment on galaxy quenching