40 minutes should be fine if HBO, maybe a bit longer if you have bags to check in. Even if the security queue is backed up to the escalator it shouldn't take 15 minutes to get through, and at that hour I can't see there being much of a problem. Unlike Heathrow and Gatwick, the deadline for check-in is 20 minutes before departure but I wouldn't advocate leaving it that tight. There again it should work out fine if you did.
At least in theory you cannot check-in bags more than 2 hours early.