Fixed #21146 - DatabaseCache converts expires to python value

DatabaseCache uses raw cursors to bypass the ORM. This prevents it from
being used by database backends that require special handling of datetime
values.