A timelock is a type of encumbrance that restricts bitcoin from being spent until a specified time in the future or block height is met. One can think of a timelock as a timer for bitcoin transactions.
Timelocks are used in both payment channels and HTLCs, but they are also a simple and elegant way to schedule a transaction to occur on a certain date (CLTV) or block height (CSV) in the future.
CLTV is a soft fork in BIP65 that allows timelocks to act as an encumbrance on transaction outputs. In this way, one can set up a transaction to process only after or before a specified date.
CSV is part of the BIP68/112/113 soft fork that allows inputs in valid blocks only if it’s relative lock time expires before it is added to the block. CSV is a critical part of Lightning Network transactions.
- Timelock – Bitcoin Wiki