Generalized Abel-Plana formula as a renormalization tool in quantum field theory with boundaries