UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H938IHa6ar9hwuCil2omI/m06OZN+pCM9I8NtsIZJ+E=' 
WHERE 
  key_id = '7a94751772f639a80f5b8dee683b5731443a4338e890f948cf1209492af967e1' 
  AND (
    token = 'H938IHa6ar9hwuCil2omI/m06OZN+pCM9I8NtsIZJ+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032