In the script, before calling 64-bit tools set LD_LIBRARY_PATH to 64-bit *.so.
As per my understanding executable will take the correct *.so, if both 32-bit and 64-bit *.so are there in the LD_LIBRARY_PATH as loaders know to ignore libraries of the wrong architecture.
For more info see this How do shared libraries work in a mixed 64bit/32bit system?