Implement pessimistic connection invalidation (MySQL only):

Check every connection that has been checked out from pool, and
invalidate it if it's stale.

(cherry picked from commit 54aaceff22791dfdc7bc523c77ace6216a39b2fa)
Merge pull request #703 from 4teamwork/lg-backport-pr-700-to-4.0

Backport: Implement pessimistic connection invalidation (MySQL only)