Can a lock be cooled enough to make it easier to break? Because in real life cooling metal can make it brittle, and as a player with no lockpicking skills, i need an alternative way to break locks. If so, would the spell have to be high level, or would a ray of frost suffice?
Depends who you ask, but generally no.
There's no RAW mechanic for low temperatures making things easier to break in general, and very few spells include such (and ray of frost isn't one of them). The closest you're going to get is cone of cold turning creatures it kills into ice statues.
The best you're looking at is to pitch the idea to your DM, who might allow it under creative use of a spell, but they're also within their rights to deny it and they have the final word on it.
In D&D you can basically do whatever. You describe what your character is doing, and possibly what they hope to achieve, and your DM makes a ruling either based on the rules, or their opinion. There isn't any rules for freezing locks, but there isn't any rules for most things, that's just the way the game works.
As you said, in real life cooling metal makes it brittle, so it's reasonable to think that freezing a lock would make it easier to destroy. Ultimately you need to ask your DM, but it sounds fine to me.