The first time when AD Sync is done, the table is populated with all active mailboxes. If something changes (mailbox is removed, or moved), the table will be updated, but no entries will be removed.
Therefore, once the mailbox is moved to Office 365 the Has mailbox flag is still in place.
The LastUpdateDateUtc is updated every 24 hours after last AD Sync. If you did AD Sync manually, it will do the next one in 24 hours time automatically, otherwise it is running every 24 hours.
Therefore, everything which is older than one day could be removed, but only if the AD Sync was done. To be sure you can run it from Active Directory screen manually .
To get this data up to date everything older than LastUpdateDateUtc could be removed, as it does not exist in AD any more.
First select, it will show all the entries that will be removed later:
select * from ExchangeMailbox where LastUpdateDateUtc < YYYY-MM-DD hh:mm:ss.sss'
Then remove, it will remove all old entries and mailbox flag should disappear:
delete from ExchangeMailbox where LastUpdateDateUtc < YYYY-MM-DD hh:mm:ss.sss'