When is a app license invalid?

In general, license sizes of the app have to match the license size of the application (Confluence, JIRA, ...). This check is not run if either of the licenses is an evaluation license.

Additional conditions that can invalidate a license: expiration date, type mismatch, edition mismatch, version mismatch (is the app version compatible to the version of the application?). You can find a detailed explanation in the Atlassian documentation.