usually I see that lock script: "OP_DUP OP_HASH160 <key> OP_EQUALVERIFY OP_CHECKSIG" and the type of the transaction is "pubkeyhash"
It is not a "key" in that script it is a hash or more specifically a 160-bit hash. It is also called pay to pubkey hash or P2PKH for short.
Now I have this lock script: "OP_HASH160 <key> OP_EQUAL" and the transaction type is "scripthash".
Same as above it is a hash not a key and it is called pay to script hash or P2SH for short.
How is it possible to spend this UTXO?
P2SH scripts are a special case that were added many years ago through a soft fork that is explained in BIP-16[1]. The way these scripts are evaluated is that first the top stack element is popped (meaning at least 1 element is needed) and hashed using SHA256 and RIPEMD160 hash algorithms in that order and the result is compared with the 160-bit hash in locking script.
Then that item (byte array) is evaluated as if it were a script called Redeem Script. The rest is like any script evaluation (eg. push some data to the stack, pop data, run CheckSig ops, etc.).
[1]
https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki