UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dq9Ij7XtptklPL2Jv1qlZEzK05XSX5G8NFhDf+kdwnE=' 
WHERE 
  key_id = '1879ca1e2948305b19bb4428d6ba0b38ffe23f16ef0e605d803b1f9aa7af90a9' 
  AND (
    token = 'Dq9Ij7XtptklPL2Jv1qlZEzK05XSX5G8NFhDf+kdwnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036