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