Existence and nonexistence results for a class of linear and semilinear parabolic equations related to some Caffarelli-Kohn-Nirenberg inequalities