remove bind values for where clauses that were removed

Cherry picking following commit did not work.
https://github.com/rails/rails/commit/50823452f70341447a010df27dd514fd97bfe8a9

This commit is backport of the above commit for 4-0-stable.

fixes #10958
Merge pull request #10981 from neerajdotname/10958

remove bind values for where clauses that were removed