UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w4dKWpK0QW1QwQ592ab7pXgc3+J1ZBM3X8/c2rPbV90=' 
WHERE 
  key_id = '88f07db1d16e1975a6a12579343999ff46165f0043483faf9f95ec21d69dc688' 
  AND (
    token = 'w4dKWpK0QW1QwQ592ab7pXgc3+J1ZBM3X8/c2rPbV90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046