UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kY1NcNNMppZQnUS5AVjFuDmYRXUuGfQDknU8VM8dwno='
WHERE
key_id = '9e85457975b5e3e04ef0b5f1e6771c953b3d36beb2bdd82c0ec0e5ff1047beca'
AND (
token = 'kY1NcNNMppZQnUS5AVjFuDmYRXUuGfQDknU8VM8dwno='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)