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