UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QNxgI2RX4pnNBuC/jH3qDvItyjsuTsVM6yA6Jt82z1E='
WHERE
key_id = 'a149e3b0cb2934118509c56746b24d6faaff15863fdaa4973400cdbfd5c5c676'
AND (
token = 'QNxgI2RX4pnNBuC/jH3qDvItyjsuTsVM6yA6Jt82z1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)