There are roughly three kinds of moods you need to be able to tell apart in snakes:
How exactly these moods look differs immensely between species and even specimens. Even snakes can have wildly varying personalities.
'Essing up'
For example, the "essing up" which my boa constrictor will sometimes do is a defensive/offensive stance, and suggests that it might strike,
Not necessarily. Sure, having this 'S'-shape in their body will mean that if they strike, they can suddenly cover a bigger distance, but that doesn't mean that always if they coil up like this they want to strike, and neither do they always coil up before striking. So all in all, it is a bad indicator.
My Boa will just idly hang down her branch. This kinda looks like an ambush position, but that does not reflect her attitude when the cage is opened, so I'm going to chalk it up as idle.
My Ball python will also do this as a part of their defensive posture, even when they have no intention of striking. Having their head closer to their body also means that it is easier for them to protect their head.
All in all, I'd say it isn't the best indicator for their mood.
Tongue-flicking
Snakes have very bad eye-sight. So they rely very much on scent as sense. For this they use their iconic tongue-flicking. Each time they do that, they smell their surroundings using an organ in the top of their mouth.
The way they use this is very indicative for their mood. If they are relaxed and moving around, they'll just flick lazily every now and then to take in their surroundings, to check if there is anything interesting somewhere.
When they have to be more aware of their surroundings, for example if they feel that they are in danger, or that there is food somewhere nearby, they will be flicking a lot more. Mostly I would describe it as much more agitated. Many short flicks.
At this point, it is still hard to distinguish food-mode from angry-mode, but that will come with:
Movement around them
This is about the situation when you are near the snake, with the cage open for example.
How does the snake react to your movements.
If they are relaxed, they might very well just ignore you. They'll go about their happy business, whether that is sleeping (likely) or exploring (depends a bit on species).
As you can see above, she is just moving around, minding her own business, tongue-flicking every now and then and ignoring my movement with the camera :)
However, if they are agitated, they will be much more inclined to follow any movement around them. This might be very subtle, like tracking the movement just with an eye, or they might just follow it with their head. This is a point where it is easier to tell defensiveness apart from a food-response.
Snakes that feel threatened are not likely to give chase. Of course it depends on the species and disposition of the snake, but if they feel threatened, most of all they just want to be left alone. Getting away is always a win.
However, if the threat doesn't go away, they might bite. Some species decide to bite very quickly, some species are known for being general assholes, but most commonly kept snakes are pretty laid back. For example, my Ball python is 10 years old now, and in the 8 years I have had him, he has struck only twice out of self-defense.
In contrast, if the movement has sparked their interest because they think it is food, their reaction (on top of tongue-flicking) will be more forward. They will be much more inclined to follow the movement in a forward direction, inching towards it.
This can be seen in the gif below. This is my Boa's reaction to food in its enclosure. You can see their immediate attention. You can see her tongue-flicking and essing up. But the two most important things to take away here are that she moves her head towards any movement and actively follows it, along with creaping forward. This shows a great deal of interest, and her going forward towards the movement is a great tell that this is not a defensive posture.
Flighty behaviour
When you are handling your snake and they are not comfortable, this might also show itself in the snake suddenly trying to move away quickly, as if they are trying to flee. This should really speak for itself.
Experience
A lot of this is down to experience and really relies on getting to know your snake. Some snakes are really keen on food and will turn into food-mode on a whim. It is important to know how to recognise this and when you only just have the snake, it is never a bad idea to err on the safe side.
If you do it right, you should never really be the target of their food-mood. First you get to know what triggers it, then you make sure you prevent that from happening whenever it is not time for food.
For many snakes, one such trigger will be the scent of their food. This is generally easy to handle by making sure food items are only nearby when it's actually feeding time and by washing your hands afterwards.
Similarly, after a while you'll learn to notice when your snake is not comfortable and be able know when to leave them alone.