UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7igq4QH1pnGAU6lGaJdECjE+cwz0IsDhnc3Oce1Om44=' 
WHERE 
  key_id = '215fea402f48b3a05aaac32f7ba8ca002309c85d8a01072d8029bbfb09d2b847' 
  AND (
    token = '7igq4QH1pnGAU6lGaJdECjE+cwz0IsDhnc3Oce1Om44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035