UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CpezWAy0LXoCqSxmZszn3Dbc4R/JcRxoZyrsm60grpc='
WHERE
key_id = 'e0d8965299f7c197dfe044d282057c42984ec650ed062b1d6ed578aae3a3a945'
AND (
token = 'CpezWAy0LXoCqSxmZszn3Dbc4R/JcRxoZyrsm60grpc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)