[DDC-2310] [DDC-2675] [2.4] Fix SQL generation on table lock hint capable platforms

Backport of PR https://github.com/doctrine/doctrine2/pull/910 for 2.4 branch.