Using an expression mapping is the easiest way to do this:
nnoremap <expr> <CR> &buftype ==# 'quickfix' ? "\<CR>" : 'za'
This defines a mapping that checks whether you are in the quickfix window, and then performs either a
Mapping to a function
You can also define a function that carries out a regular enter when invoked from the quickfix window, and does 'za' otherwise. This isn't efficient for what you're trying to do, but I'm leaving it here because it's useful info for if you want to map to something more complicated than a normal mode command:
if &buftype ==# 'quickfix'
execute "normal! \<CR>"
nnoremap <CR> :call FoldingEnter()<CR>