UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KtSXhBUjWyi0Fijm6IBTsSa1yr+9shLT/OBQxNkpGho=' 
WHERE 
  key_id = '30ee351d0a84d3b9cea8a074f2ab11f9978a90e86c8afb9e3d3923759ddd6971' 
  AND (
    token = 'KtSXhBUjWyi0Fijm6IBTsSa1yr+9shLT/OBQxNkpGho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037