UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vxidu0RKK1Wj+BkwTOJ9OgnMm0qEUAU1zuyyS6Df2e8=' 
WHERE 
  key_id = '797277479e4ca97ca4e0277ace02a09f3059169dfe0e05c3faa0e605f73b0b91' 
  AND (
    token = 'Vxidu0RKK1Wj+BkwTOJ9OgnMm0qEUAU1zuyyS6Df2e8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025