UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FLi5bsieRjE5LPZ8jwqmvZDHbLwUCBEtK3aoFVyPpkM=' 
WHERE 
  key_id = '174a90eb8477b2795701d2512f1659c5583121168f0b4a9b7901a5d2ab8dcfce' 
  AND (
    token = 'FLi5bsieRjE5LPZ8jwqmvZDHbLwUCBEtK3aoFVyPpkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040