UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LPPiT8R2p1vlgEEymjRGy/ledMtHJ+sWZjkiLsxAyuQ=' 
WHERE 
  key_id = '9e29ac20d7c8e120e150a21ece04dee583ab15af14df8ffa9faf38659f95819c' 
  AND (
    token = 'LPPiT8R2p1vlgEEymjRGy/ledMtHJ+sWZjkiLsxAyuQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028