UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pIPPxu5438O55IpstmpL5IBNoaZNGtfc8Glaia4BLw4=' 
WHERE 
  key_id = '312a439abac4ea6f76e84a00cc99ac5279ffc92c415bfecca04ee62e413c03f9' 
  AND (
    token = 'pIPPxu5438O55IpstmpL5IBNoaZNGtfc8Glaia4BLw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018