The unique id is...
Tracking Handles
Duplicate tracking considers only messages which are tagged with the same handle. The rational is to have multiple tracking policies. In case no handle it provided the server will use a default one. A custom handle can be any unique strings.

Expiration
The server uses a duplicate message list to track duplicates. To keep this list small and fast, the list entries expire. After a list entry is expired it is no more considered as a Duplicate

Expiration time uses either the point in time when the entry in the duplicate message list was created or the point in time when the duplicate message entry was last accessed.

The main application for this test is handling duplicate deliveries commonly caused by mailing list subscriptions or redirected mail addresses.

The detection is normally performed by matching the message ID to an internal list of message IDs from previously delivered messages.

For more complex applications, the "duplicate" test can also use the content of a specific header field or other parts of the message.

Duplicate deliveries are a common side effect of being subscribed to a mailing list. For example, if a member of the list decides to reply to both the user and the mailing list itself, the user will often get one copy of the message directly and another through the mailing list.