UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E1P++2wxQQFe9yiPZMbu25DlpHpvxDcenUwReGBg8ns=' 
WHERE 
  key_id = '4160c1ae7d882da17e460c4c4dfcd4259a33b5bf22ee123e8ec93a61d240dc5c' 
  AND (
    token = 'E1P++2wxQQFe9yiPZMbu25DlpHpvxDcenUwReGBg8ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034