Biological treatment of produced water