Wrong results for database query with date comparison

Hi

I have the following code for cakephp/cakephp": "~4.2.0:

$posts = $this->Posts->find()->where([
            'published IS NOT NULL',
            'user_id !=' => $this->_user_id,
            'published <=' => '2021-07-09 09:27:45'
        ])->order(['published' => 'DESC'])->limit(PAGINATE_LIMIT)->toArray();

which generates the following SQL

SELECT 
  Posts.id AS Posts__id, 
  Posts.user_id AS Posts__user_id, 
  Posts.created AS Posts__created, 
  Posts.modified AS Posts__modified, 
  Posts.updated AS Posts__updated, 
  Posts.published AS Posts__published, 
  Posts.summary AS Posts__summary, 
  Posts.text AS Posts__text 
FROM 
  posts Posts 
WHERE 
  (
    published IS NOT NULL 
    AND user_id != '60e6b7aeebd9a5.55375706' 
    AND published <= '2021-07-09 09:27:45'
  ) 
ORDER BY 
  published DESC 
LIMIT 
  5

But returns the wrongs results. Even after flipping the comparator.

If I copy and paste the SQL directly on MySQL, it returns the correct result.