UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nxWaeNcnKT2cLD09AvbX31qr1qOhhfKziJZVbvoF1c0='
WHERE
key_id = 'db3c9123965955d106892c2400e65f71f8f4afcd68a1d66b923f52272419ccdd'
AND (
token = 'nxWaeNcnKT2cLD09AvbX31qr1qOhhfKziJZVbvoF1c0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)