If we make the assuption that the user defined Release name and the newly created Releases in Management module are having same name and they are not repeated, then you can use following query. If two releases have same name, this will result in error. since this is an update statement i didn't want to test in my system, so let me know how it goes.
UPDATE BUG SET BG_TARGET_REL = (SELECT REL_ID FROM RELEASES WHERE REL_NAME = BG_USER_01)
P.S BG_USER_01 is the user field which refers to user defined release names.