UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xPvmglhflGaJ1CZEpFm2bpeiGfluyDSPu07oogmyyUQ='
WHERE
key_id = '77946aefb4291e1b40bc99ad8811499a2c9c67637b1d8a2d69e3c534e22515df'
AND (
token = 'xPvmglhflGaJ1CZEpFm2bpeiGfluyDSPu07oogmyyUQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)