Concatenation. "I have" and "I've" mean the same thing. The latter is used more in conversation as it sounds better. The "had" might indicate a completed action but the intent of both sentences is that the person wants a cup of coffee, likely to be awake. Both sentences are trying to say the same thing. Technically, the second sentence is better because the actions agree with a time frame: one can't work hard while having a coffee at the same time.